package com.ruoyi.xh.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TablePageDataInfo;
import com.ruoyi.common.core.domain.CommentResult;
import com.ruoyi.xh.domain.XhOrderFeedback;
import com.ruoyi.xh.service.IXhOrderFeedbackService;

/**
 * 订单反馈Controller
 *
 * @author songjw
 * @date 2024-12-13
 */
@Api(tags = "订单反馈Controller",value = "订单反馈Controller")
@RestController
@RequestMapping("/xh/orderFeedback")
public class XhOrderFeedbackController extends BaseController {

    @Autowired
    private IXhOrderFeedbackService xhOrderFeedbackService;

    /**
     * 查询订单反馈列表
     */
    @PreAuthorize("@ss.hasPermi('xh:orderFeedback:list')")
    @GetMapping("/list")
    @ApiOperation("查询订单反馈列表")
    public TablePageDataInfo<XhOrderFeedback> list(XhOrderFeedback xhOrderFeedback) {
        return TablePageDataInfo.success(xhOrderFeedbackService.selectXhOrderFeedbackList(xhOrderFeedback));
    }

    /**
     * 获取订单反馈详细信息
     */
    @PreAuthorize("@ss.hasPermi('xh:orderFeedback:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取订单反馈详细信息")
    public CommentResult<XhOrderFeedback> getInfo(@PathVariable("id") Long id) {
        return CommentResult.success(xhOrderFeedbackService.selectXhOrderFeedbackById(id));
    }

    /**
     * 新增订单反馈
     */
    @PreAuthorize("@ss.hasPermi('xh:orderFeedback:add')")
    @Log(title = "订单反馈", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增订单反馈")
    public CommentResult<XhOrderFeedback> add(@RequestBody XhOrderFeedback xhOrderFeedback) {
            xhOrderFeedbackService.insertXhOrderFeedback(xhOrderFeedback);
        return CommentResult.success();
    }

    /**
     * 修改订单反馈
     */
    @PreAuthorize("@ss.hasPermi('xh:orderFeedback:edit')")
    @Log(title = "订单反馈", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改订单反馈")
    public CommentResult<XhOrderFeedback> edit(@RequestBody XhOrderFeedback xhOrderFeedback) {
            xhOrderFeedbackService.updateXhOrderFeedback(xhOrderFeedback);
        return CommentResult.success();
    }

    /**
     * 删除订单反馈
     */
    @PreAuthorize("@ss.hasPermi('xh:orderFeedback:remove')")
    @Log(title = "订单反馈", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除订单反馈")
    public CommentResult<XhOrderFeedback> remove(@PathVariable Long[] ids) {
            xhOrderFeedbackService.deleteXhOrderFeedbackByIds(ids);
        return CommentResult.success();
    }
}
